angular.module('service.market', [
    "ngResource",
])
    //认证服务
    .service('MarketService', ['$resource',function($resource){
        //读取数组
        this.get = function(){
            var market = $resource(marketurl+ 'market');
            return market.query();
        };
        //根据id单个读取
        this.getByid = function(id,success,error){
            var market = $resource(marketurl+ 'market/:id');
            return market.get({id:id},success,error)
        };
        //上传对象
        this.update = function(data){
            var market = $resource(marketurl+ 'market');
            return market.save(data);
        };
        //根据id更新
        this.update = function(data,success,error){
            var market = $resource(marketurl+ 'market/:id');
            return market.save({id:data.id},data,success,error);
        };
        //获取二维码链接
        this.getqrcode =function(data){
            return  $resource(receiptUrl+":machid").get({machid:data.machid,amount:data.amount});
        };
    }])